const compressing = require('compressing');

// 文件压缩
function compress(path, name) {
  return new Promise((resolve, reject) => {
    compressing.zip.compressDir(path, name).then(() => {
      resolve(true);
    }).catch(reject);
  });
}

// 文件解压
function uncompress(from, to) {
  return new Promise((resolve, reject) => {
    compressing.zip.uncompress(from, to).then(() => {
      resolve(true);
    }).catch(() => {
      resolve(false);
    });
  })
}

module.exports = {
  compress,
  uncompress
}